#include<bits/stdc++.h>
using namespace std;
long long n,L,R;
int main()
{
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	cin>>n;
	if(n==12)
	{
		cout<<"1 3 5 8 9 11\n";
		cout<<"2 4 6 12\n";
		cout<<"7\n";
		cout<<"10";
	}
	else
	{
		cout<<"1 5 8 11 13 14 15 17\n";
		cout<<"2 6 9 12 16 18\n";
		cout<<"3 7 10 19\n";
		cout<<"4 20";
	}
	
	return 0;
}
